<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <style>
        .updateBtn{
            display: block;
            text-decoration: none;
            width: 60px;
            height: 20px;
            border: none;
            font-size: 13px;
            text-align: center;
            line-height: 20px;
            background-color: crimson;
            color: whitesmoke;
            border-radius: 4px;
            float: left;
            margin-left: 50px;
        }
    </style>
</head>
<body>
<h3>获得所有的用户信息</h3>

<%--迭代遍历  集合中的数据 --%>
<c:forEach var="user" items="${userList}">
    用户id:${user.id}  <br>
    用户名：${user.username}  <br>
    用户角色：
    <c:if test="${user.power == 0}">
        超级管理员
    </c:if>
    <c:if test="${user.power == 1}">
        普通用户
    </c:if>
    <br>

    <a href="GetUserByIdUpdateServlet?id=${user.id}" class="updateBtn">
        修改
    </a>


    <a href="javascript:deleteUser(${user.id})"  class="updateBtn deleteBtn">
        删除
    </a>
    <span style="color: red">${msg}</span>
    <br>
    <hr/>
</c:forEach>

<script>
    function deleteUser(id){
        var result = window.confirm("你确定要删除该条记录么?");
        if(result){
            location.href ="DeleteUserServlet?id="+id;
        }
    }

</script>


</body>
</html>
